$(function(){
	//按钮一
	var fuText;
    var searchb = function() {   
    	url = "/modules/report/project/mainJson.html";
    	ajaxUrl2(url);
    }
    
    var ajaxUrl2 = function(url){
		$.ajax({
			url:url + "?randomTime=" + (new Date()).getTime(),
			type:"get",
			dataType:"json",
			cache:false,
			success:function(data){
				var option;
				var dataVal = [];
				for (var i = 0; i < data.projectStatuCounts.length; i++) {
					dataVal.push({name: data.projectStatus[i],value: data.projectStatuCounts[i]});
				};
				
				option1 = {
					title : {
					    text: '股权众筹项目状态分布',
					    x:'center',
		            	y:'top',
		            	padding:30,
		            	textStyle:{
							fontSize: 24, 
							fontWeight: 'bolder'	
		            	},
		            	subtext:fuText
					},
					calculable : true,
					legend: {
				        orient : 'vertical',
				        x : '80%',
				        y : 'center',
				        data: dataVal
				    },
					tooltip : {
					    show: true,
					    formatter: "{a} <br/>{b} : {c} ({d}%)"
					},
					series : [
					    {
					        name:'状态分布',
					        type:'pie',
					        radius : '50%',
					        center: ['50%', '65%'],
					        data: dataVal
					    }
					]
				}
				
				var dataVal1 = [];
				for (var i = 0; i < data.projectStatuCounts1.length; i++) {
					dataVal1.push({name: data.projectStatus1[i],value: data.projectStatuCounts1[i]});
				};
				option2 = {
					title : {
					    text: '产品众筹项目状态分布',
					    x:'center',
		            	y:'top',
		            	padding:30,
		            	textStyle:{
							fontSize: 24, 
							fontWeight: 'bolder'	
		            	},
		            	subtext:fuText
					},
					calculable : true,
					legend: {
				        orient : 'vertical',
				        x : '80%',
				        y : 'center',
				        data: dataVal1
				    },
					tooltip : {
					    show: true,
					    formatter: "{a} <br/>{b} : {c} ({d}%)"
					},
					series : [
					    {
					        name:'状态分布',
					        type:'pie',
					        radius : '50%',
					        center: ['50%', '65%'],
					        data: dataVal1
					    }
					]
				}
				
				document.getElementById('investTablea').style.display = "inline-block";
				document.getElementById('investTableb').style.display = "inline-block";
				echarts.init(document.getElementById('investTablea')).setOption(option1);
				echarts.init(document.getElementById('investTableb')).setOption(option2);
			}
		});
	};
	
	searchb();
});